#pragma once
#include<iostream>
#include<time.h>
#define INFO 0
#define DEBUG 1
#define WARNING 2
#define ERROR 3
#define FATAL 4
#define DEFAULT_LEVEL WARNING
#define LOG(level,format,...) do{\
    /*if(level<DEFAULT_LEVEL) break;\ */\
    time_t t=time(NULL);\
    struct tm* lt=localtime(&t);\
    char buf[96]={0};\
    strftime(buf,95,"%Y-%m-%d %H:%M:%S",lt);\
    fprintf(stdout, "[%s %s:%d]" format "\n",buf,__FILE__,__LINE__,##__VA_ARGS__);\
}while(0)
#define ILOG(format,...) LOG(INFO,format,##__VA_ARGS__)
#define DLOG(format,...) LOG(DEBUG,format,##__VA_ARGS__)
#define WLOG(format,...) LOG(WARNING,format,##__VA_ARGS__)
#define ELOG(format,...) LOG(ERROR,format,##__VA_ARGS__)
#define FLOG(format,...) LOG(FATAL,format,##__VA_ARGS__)